Skip to contentSkip to conversation

Change in openvpn[master]: Clean up documentation for --tun-mtu-max

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Aug 22, 2025 – Aug 23, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1755877911000.I5e240c35cd4236e1d845195e4634fd5008f61814@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email

to review the following change.

Change subject: Clean up documentation for --tun-mtu-max
......................................................................

Clean up documentation for --tun-mtu-max

There was some confusion about how the option
was called...

Change-Id I5e240c35cd4236e1d845195e4634fd5008f61814

---
M doc/man-sections/vpn-network-options.rst
M src/openvpn/init.c
M src/openvpn/mtu.h
M src/openvpn/options.c
M src/openvpn/push.c

5 files changed, 13 insertions(+), 6 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/1152/1

doc/man-sections/vpn-network-options.rst +1 -1
index 4a64e8d..2a06ef6 100644
@@ -587,7 +587,7 @@
   packets larger than ``tun-mtu`` (e.g. Linux and FreeBSD) but other platforms
   (like macOS) limit received packets to the same size as the MTU.
 
---tun-max-mtu maxmtu
+--tun-mtu-max maxmtu
   This configures the maximum MTU size that a server can push to ``maxmtu``,
   by configuring the internal buffers to allow at least this packet size.
   The default for ``maxmtu`` is 1600. Currently, only increasing beyond 1600
src/openvpn/init.c +1 -1
index 5583274..9dd3b96 100644
@@ -2916,7 +2916,7 @@
 
     /* We always allow at least 1600 MTU packets to be received in our buffer
      * space to allow server to push "baby giant" MTU sizes */
-    frame->tun_max_mtu = max_int(1600, frame->tun_max_mtu);
+    frame->tun_max_mtu = max_int(TUN_MTU_MAX_MIN, frame->tun_max_mtu);
 
     size_t payload_size = frame->tun_max_mtu;
 
src/openvpn/mtu.h +5 -0
index 925ef0b..c092461 100644
@@ -69,6 +69,11 @@
 #define TUN_MTU_DEFAULT 1500
 
 /*
+ * Minimum maximum MTU
+ */
+#define TUN_MTU_MAX_MIN 1600
+
+/*
  * MTU Defaults for TAP devices
  */
 #define TAP_MTU_EXTRA_DEFAULT 32
src/openvpn/options.c +5 -3
index e9584a8..0b16c5a 100644
@@ -297,6 +297,7 @@
     "--tun-mtu-extra n : Assume that tun/tap device might return as many\n"
     "                  as n bytes more than the tun-mtu size on read\n"
     "                  (default TUN=0 TAP=%d).\n"
+    "--tun-mtu-max n : Maximum pushable MTU (default and minimum=%d).\n"
     "--link-mtu n    : Take the TCP/UDP device MTU to be n and derive the tun MTU\n"
     "                  from it.\n"
     "--mtu-disc type : Should we do Path MTU discovery on TCP/UDP channel?\n"
@@ -4844,8 +4845,9 @@
 
     fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds,
             o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
-            TAP_MTU_EXTRA_DEFAULT, o.verbosity, o.authname, o.replay_window, o.replay_time,
-            o.tls_timeout, o.renegotiate_seconds, o.handshake_window, o.transition_window);
+            TAP_MTU_EXTRA_DEFAULT, TUN_MTU_MAX_MIN, o.verbosity, o.authname, o.replay_window,
+            o.replay_time, o.tls_timeout, o.renegotiate_seconds, o.handshake_window,
+            o.transition_window);
     fflush(fp);
 
 #endif                                       /* ENABLE_SMALL */
@@ -7011,7 +7013,7 @@
             options->ce.occ_mtu = 0;
         }
     }
-    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[3])
+    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[2])
     {
         VERIFY_PERMISSION(OPT_P_MTU | OPT_P_CONNECTION);
         int max_mtu = positive_atoi(p[1], msglevel);
src/openvpn/push.c +1 -1
index 889b268..4f6adfc 100644
@@ -721,7 +721,7 @@
         {
             msg(M_WARN,
                 "Warning: reported maximum MTU from client (%d) is lower "
-                "than MTU used on the server (%d). Add tun-max-mtu %d "
+                "than MTU used on the server (%d). Add tun-mtu-max %d "
                 "to client configuration.",
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e240c35cd4236e1d845195e4634fd5008f61814
Gerrit-Change-Number: 1152
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email )

Change subject: Clean up documentation for --tun-mtu-max
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e240c35cd4236e1d845195e4634fd5008f61814
Gerrit-Change-Number: 1152
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 22 Aug 2025 20:57:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 Clean up documentation for --tun-mtu-max

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

There was some confusion about how the option
was called...

Change-Id I5e240c35cd4236e1d845195e4634fd5008f61814

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1152
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

doc/man-sections/vpn-network-options.rst +1 -1
index 4a64e8d..2a06ef6 100644
@@ -587,7 +587,7 @@
   packets larger than ``tun-mtu`` (e.g. Linux and FreeBSD) but other platforms
   (like macOS) limit received packets to the same size as the MTU.
 
---tun-max-mtu maxmtu
+--tun-mtu-max maxmtu
   This configures the maximum MTU size that a server can push to ``maxmtu``,
   by configuring the internal buffers to allow at least this packet size.
   The default for ``maxmtu`` is 1600. Currently, only increasing beyond 1600
src/openvpn/init.c +1 -1
index 5583274..9dd3b96 100644
@@ -2916,7 +2916,7 @@
 
     /* We always allow at least 1600 MTU packets to be received in our buffer
      * space to allow server to push "baby giant" MTU sizes */
-    frame->tun_max_mtu = max_int(1600, frame->tun_max_mtu);
+    frame->tun_max_mtu = max_int(TUN_MTU_MAX_MIN, frame->tun_max_mtu);
 
     size_t payload_size = frame->tun_max_mtu;
 
src/openvpn/mtu.h +5 -0
index 925ef0b..c092461 100644
@@ -69,6 +69,11 @@
 #define TUN_MTU_DEFAULT 1500
 
 /*
+ * Minimum maximum MTU
+ */
+#define TUN_MTU_MAX_MIN 1600
+
+/*
  * MTU Defaults for TAP devices
  */
 #define TAP_MTU_EXTRA_DEFAULT 32
src/openvpn/options.c +5 -3
index e9584a8..0b16c5a 100644
@@ -297,6 +297,7 @@
     "--tun-mtu-extra n : Assume that tun/tap device might return as many\n"
     "                  as n bytes more than the tun-mtu size on read\n"
     "                  (default TUN=0 TAP=%d).\n"
+    "--tun-mtu-max n : Maximum pushable MTU (default and minimum=%d).\n"
     "--link-mtu n    : Take the TCP/UDP device MTU to be n and derive the tun MTU\n"
     "                  from it.\n"
     "--mtu-disc type : Should we do Path MTU discovery on TCP/UDP channel?\n"
@@ -4844,8 +4845,9 @@
 
     fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds,
             o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
-            TAP_MTU_EXTRA_DEFAULT, o.verbosity, o.authname, o.replay_window, o.replay_time,
-            o.tls_timeout, o.renegotiate_seconds, o.handshake_window, o.transition_window);
+            TAP_MTU_EXTRA_DEFAULT, TUN_MTU_MAX_MIN, o.verbosity, o.authname, o.replay_window,
+            o.replay_time, o.tls_timeout, o.renegotiate_seconds, o.handshake_window,
+            o.transition_window);
     fflush(fp);
 
 #endif                                       /* ENABLE_SMALL */
@@ -7011,7 +7013,7 @@
             options->ce.occ_mtu = 0;
         }
     }
-    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[3])
+    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[2])
     {
         VERIFY_PERMISSION(OPT_P_MTU | OPT_P_CONNECTION);
         int max_mtu = positive_atoi(p[1], msglevel);
src/openvpn/push.c +1 -1
index 889b268..4f6adfc 100644
@@ -721,7 +721,7 @@
         {
             msg(M_WARN,
                 "Warning: reported maximum MTU from client (%d) is lower "
-                "than MTU used on the server (%d). Add tun-max-mtu %d "
+                "than MTU used on the server (%d). Add tun-mtu-max %d "
                 "to client configuration.",
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: Clean up documentation for --tun-mtu-max

This all makes sense - thanks for spotting. No idea what we were looking at when merging the original patch...

Not sure introducing the extra define improves readability (the old context made it quite clear that "1600" is not "a random number out of thin air")
- but since TUN_MTU_DEFAULT has a define in mtu.h, why not.

Your patch has been applied to the master branch.

commit 5c4744f28e2adb3fc8f6fb3b3c8ffe22636eb0a0

Author: Frank Lichtenheld
Date:   Sat Aug 23 17:36:46 2025 +0200
     Clean up documentation for --tun-mtu-max

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg32663.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: Clean up documentation for --tun-mtu-max
......................................................................

Clean up documentation for --tun-mtu-max

There was some confusion about how the option
was called...

Change-Id I5e240c35cd4236e1d845195e4634fd5008f61814

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32663.html

---
M doc/man-sections/vpn-network-options.rst
M src/openvpn/init.c
M src/openvpn/mtu.h
M src/openvpn/options.c
M src/openvpn/push.c

5 files changed, 13 insertions(+), 6 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/1152/2

doc/man-sections/vpn-network-options.rst +1 -1
index 4a64e8d..2a06ef6 100644
@@ -587,7 +587,7 @@
   packets larger than ``tun-mtu`` (e.g. Linux and FreeBSD) but other platforms
   (like macOS) limit received packets to the same size as the MTU.
 
---tun-max-mtu maxmtu
+--tun-mtu-max maxmtu
   This configures the maximum MTU size that a server can push to ``maxmtu``,
   by configuring the internal buffers to allow at least this packet size.
   The default for ``maxmtu`` is 1600. Currently, only increasing beyond 1600
src/openvpn/init.c +1 -1
index 5583274..9dd3b96 100644
@@ -2916,7 +2916,7 @@
 
     /* We always allow at least 1600 MTU packets to be received in our buffer
      * space to allow server to push "baby giant" MTU sizes */
-    frame->tun_max_mtu = max_int(1600, frame->tun_max_mtu);
+    frame->tun_max_mtu = max_int(TUN_MTU_MAX_MIN, frame->tun_max_mtu);
 
     size_t payload_size = frame->tun_max_mtu;
 
src/openvpn/mtu.h +5 -0
index 925ef0b..c092461 100644
@@ -69,6 +69,11 @@
 #define TUN_MTU_DEFAULT 1500
 
 /*
+ * Minimum maximum MTU
+ */
+#define TUN_MTU_MAX_MIN 1600
+
+/*
  * MTU Defaults for TAP devices
  */
 #define TAP_MTU_EXTRA_DEFAULT 32
src/openvpn/options.c +5 -3
index e9584a8..0b16c5a 100644
@@ -297,6 +297,7 @@
     "--tun-mtu-extra n : Assume that tun/tap device might return as many\n"
     "                  as n bytes more than the tun-mtu size on read\n"
     "                  (default TUN=0 TAP=%d).\n"
+    "--tun-mtu-max n : Maximum pushable MTU (default and minimum=%d).\n"
     "--link-mtu n    : Take the TCP/UDP device MTU to be n and derive the tun MTU\n"
     "                  from it.\n"
     "--mtu-disc type : Should we do Path MTU discovery on TCP/UDP channel?\n"
@@ -4844,8 +4845,9 @@
 
     fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds,
             o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
-            TAP_MTU_EXTRA_DEFAULT, o.verbosity, o.authname, o.replay_window, o.replay_time,
-            o.tls_timeout, o.renegotiate_seconds, o.handshake_window, o.transition_window);
+            TAP_MTU_EXTRA_DEFAULT, TUN_MTU_MAX_MIN, o.verbosity, o.authname, o.replay_window,
+            o.replay_time, o.tls_timeout, o.renegotiate_seconds, o.handshake_window,
+            o.transition_window);
     fflush(fp);
 
 #endif                                       /* ENABLE_SMALL */
@@ -7011,7 +7013,7 @@
             options->ce.occ_mtu = 0;
         }
     }
-    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[3])
+    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[2])
     {
         VERIFY_PERMISSION(OPT_P_MTU | OPT_P_CONNECTION);
         int max_mtu = positive_atoi(p[1], msglevel);
src/openvpn/push.c +1 -1
index 889b268..4f6adfc 100644
@@ -721,7 +721,7 @@
         {
             msg(M_WARN,
                 "Warning: reported maximum MTU from client (%d) is lower "
-                "than MTU used on the server (%d). Add tun-max-mtu %d "
+                "than MTU used on the server (%d). Add tun-mtu-max %d "
                 "to client configuration.",
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e240c35cd4236e1d845195e4634fd5008f61814
Gerrit-Change-Number: 1152
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email )

Change subject: Clean up documentation for --tun-mtu-max
......................................................................

Clean up documentation for --tun-mtu-max

There was some confusion about how the option
was called...

Change-Id I5e240c35cd4236e1d845195e4634fd5008f61814

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32663.html

---
M doc/man-sections/vpn-network-options.rst
M src/openvpn/init.c
M src/openvpn/mtu.h
M src/openvpn/options.c
M src/openvpn/push.c

5 files changed, 13 insertions(+), 6 deletions(-)
doc/man-sections/vpn-network-options.rst +1 -1
index 4a64e8d..2a06ef6 100644
@@ -587,7 +587,7 @@
   packets larger than ``tun-mtu`` (e.g. Linux and FreeBSD) but other platforms
   (like macOS) limit received packets to the same size as the MTU.
 
---tun-max-mtu maxmtu
+--tun-mtu-max maxmtu
   This configures the maximum MTU size that a server can push to ``maxmtu``,
   by configuring the internal buffers to allow at least this packet size.
   The default for ``maxmtu`` is 1600. Currently, only increasing beyond 1600
src/openvpn/init.c +1 -1
index 5583274..9dd3b96 100644
@@ -2916,7 +2916,7 @@
 
     /* We always allow at least 1600 MTU packets to be received in our buffer
      * space to allow server to push "baby giant" MTU sizes */
-    frame->tun_max_mtu = max_int(1600, frame->tun_max_mtu);
+    frame->tun_max_mtu = max_int(TUN_MTU_MAX_MIN, frame->tun_max_mtu);
 
     size_t payload_size = frame->tun_max_mtu;
 
src/openvpn/mtu.h +5 -0
index 925ef0b..c092461 100644
@@ -69,6 +69,11 @@
 #define TUN_MTU_DEFAULT 1500
 
 /*
+ * Minimum maximum MTU
+ */
+#define TUN_MTU_MAX_MIN 1600
+
+/*
  * MTU Defaults for TAP devices
  */
 #define TAP_MTU_EXTRA_DEFAULT 32
src/openvpn/options.c +5 -3
index e9584a8..0b16c5a 100644
@@ -297,6 +297,7 @@
     "--tun-mtu-extra n : Assume that tun/tap device might return as many\n"
     "                  as n bytes more than the tun-mtu size on read\n"
     "                  (default TUN=0 TAP=%d).\n"
+    "--tun-mtu-max n : Maximum pushable MTU (default and minimum=%d).\n"
     "--link-mtu n    : Take the TCP/UDP device MTU to be n and derive the tun MTU\n"
     "                  from it.\n"
     "--mtu-disc type : Should we do Path MTU discovery on TCP/UDP channel?\n"
@@ -4844,8 +4845,9 @@
 
     fprintf(fp, usage_message, title_string, o.ce.connect_retry_seconds,
             o.ce.connect_retry_seconds_max, o.ce.local_port, o.ce.remote_port, TUN_MTU_DEFAULT,
-            TAP_MTU_EXTRA_DEFAULT, o.verbosity, o.authname, o.replay_window, o.replay_time,
-            o.tls_timeout, o.renegotiate_seconds, o.handshake_window, o.transition_window);
+            TAP_MTU_EXTRA_DEFAULT, TUN_MTU_MAX_MIN, o.verbosity, o.authname, o.replay_window,
+            o.replay_time, o.tls_timeout, o.renegotiate_seconds, o.handshake_window,
+            o.transition_window);
     fflush(fp);
 
 #endif                                       /* ENABLE_SMALL */
@@ -7011,7 +7013,7 @@
             options->ce.occ_mtu = 0;
         }
     }
-    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[3])
+    else if (streq(p[0], "tun-mtu-max") && p[1] && !p[2])
     {
         VERIFY_PERMISSION(OPT_P_MTU | OPT_P_CONNECTION);
         int max_mtu = positive_atoi(p[1], msglevel);
src/openvpn/push.c +1 -1
index 889b268..4f6adfc 100644
@@ -721,7 +721,7 @@
         {
             msg(M_WARN,
                 "Warning: reported maximum MTU from client (%d) is lower "
-                "than MTU used on the server (%d). Add tun-max-mtu %d "
+                "than MTU used on the server (%d). Add tun-mtu-max %d "
                 "to client configuration.",
                 client_max_mtu, o->ce.tun_mtu, o->ce.tun_mtu);
         }

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1152?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I5e240c35cd4236e1d845195e4634fd5008f61814
Gerrit-Change-Number: 1152
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged